{include file="public/header"/}
{include file="public/menu"/}
<div class="page-content">
<div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="{:Url('index/index')}">首页</a>
            <a>
              <cite>提现列表</cite></a>
          </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form class="layui-form layui-col-space5" action="">
                        <div class="layui-input-inline layui-show-xs-block">
                            <input style="width:240px" class="layui-input" placeholder="会员名" name="keyword"></div>
                        <div class="layui-input-inline layui-show-xs-block">
                            <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i>搜索</button>
                        </div>
                    </form>
                </div>
                <div class="layui-card-body ">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>用户名</th>
                            <th>手机号</th>
                            <th>申请金额</th>
                            <th>服务费</th>
                            <th>应付金额</th>
<!--                            <th>bank_name</th>-->
<!--                            <th>holder_name</th>-->
<!--                            <th>account_number</th>-->
<!--                            <th>phone_number</th>-->
<!--                            <th>email</th>-->
<!--                            <th>ifsc</th>-->
<!--                            <th>upi</th>-->
                            <th>状态</th>
                            <th>创建时间</th>
                            <th width="auto">操作</th>
                        </thead>
                        <tbody>
                        {volist name='list' id='vo'}
                        <tr>
                            <td>{$vo['id']}</td>
                            <td>{$vo['username']}</td>
                            <td>{$vo['phone']}</td>
                            <td>{$vo['apply_money']}</td>
                            <td>{$vo['service_money']}</td>
                            <td>{$vo['actual_money']}</td>
<!--                            <td>{$vo['bank_name']}</td>-->
<!--                            <td>{$vo['holder_name']}</td>-->
<!--                            <td>{$vo['account_number']}</td>-->
<!--                            <td>{$vo['phone_number']}</td>-->
<!--                            <td>{$vo['email']}</td>-->
<!--                            <td>{$vo['ifsc']}</td>-->
<!--                            <td>{$vo['upi']}</td>-->
                            {switch vo.agent_check}
                            {case 0}<td><span style="color: blue">等待处理</span></td>{/case}
                            {case 1}<td><span style="color: green">已支付</span></td>{/case}
                            {case 2}<td><span style="color: red">已拒绝</span></td>{/case}
                            {case 2}<td><span style="color: #4E5465">支付中</span></td>{/case}
                            {/switch}
                            <td>{$vo.create_time|toDate}</td>
                            <td class="td-status">
                            {if $vo.agent_check == 0}
                            <button type="button" onClick="pass({$vo.id})" class="layui-btn layui-btn-xs">通过</button>
                            <button type="button" onClick="refuse({$vo.id})" class="layui-btn layui-btn-danger layui-btn-xs" >拒绝</button>
                            {else /}
                            <button type="button" class="layui-btn layui-btn-disabled">已处理</button>
                            {/if}
                            </td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    <div class="page">
                        <div>
                            <td colspan="10">{$pages|raw}</td>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
{include file="public/footer"/}

    <script>
        function pass(id){
            var lock = false;
            layer.confirm('确定通过吗?',{btn:['确定','取消']},function(index){
                if(!lock) {
                    //加锁防止多次回调
                    lock =true;
                    layer.load(2);
                    $.ajax({
                        url: "{:Url('withdrawal_pass')}",
                        type: "post",
                        traditional: true,
                        data: {id:id},
                        success: function (e) {
                            layer.closeAll('loading');
                            if (e.code === 1){
                                layer.msg(e.msg, {
                                    time: 2000,
                                    end: function () {
                                        location.reload();
                                    }
                                });
                            }else {
                                layer.msg(e.msg, function(){});
                                return false;
                            }
                        },
                    });
                }
            });
        }
    </script>

    <script>
        function refuse(id){
            var lock = false;
            layer.confirm('确定拒绝吗?',{btn:['确定','取消']},function(index){
                if(!lock) {
                    //加锁防止多次回调
                    lock =true;
                    layer.load(2);
                    $.ajax({
                        url: "{:Url('withdrawal_refuse')}",
                        type: "post",
                        traditional: true,
                        data: {id:id},
                        success: function (e) {
                            layer.closeAll('loading');
                            if (e.code === 1){
                                layer.msg(e.msg, {
                                    time: 2000,
                                    end: function () {
                                        location.reload();
                                    }
                                });
                            }else {
                                layer.msg(e.msg, function(){});
                                return false;
                            }
                        },
                    });
                }
            });
        }
    </script>
